load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "stmtctx",
    srcs = ["stmtctx.go"],
    importpath = "github.com/pingcap/tidb/pkg/sessionctx/stmtctx",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/domain/resourcegroup",
        "//pkg/errctx",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/types",
        "//pkg/util/context",
        "//pkg/util/disk",
        "//pkg/util/execdetails",
        "//pkg/util/intest",
        "//pkg/util/linter/constructor",
        "//pkg/util/memory",
        "//pkg/util/nocopy",
        "//pkg/util/resourcegrouptag",
        "//pkg/util/topsql/stmtstats",
        "//pkg/util/tracing",
        "@com_github_pingcap_errors//:errors",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@com_github_tikv_client_go_v2//util",
        "@org_golang_x_exp//maps",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "stmtctx_test",
    timeout = "short",
    srcs = [
        "main_test.go",
        "stmtctx_test.go",
    ],
    embed = [":stmtctx"],
    flaky = True,
    shard_count = 12,
    deps = [
        "//pkg/errctx",
        "//pkg/kv",
        "//pkg/sessionctx/variable",
        "//pkg/testkit",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util/execdetails",
        "@com_github_pingcap_errors//:errors",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//util",
        "@org_uber_go_goleak//:goleak",
    ],
)
